Chomu's Blog.

>

Posts

GitHub

10월 26일 원티드 프리온보딩 백엔드 1일차 TIL

목차

1️⃣ 진행상황

2️⃣ 진행상황리뷰

class Method(models.Model):
    """결제 수단에 대한 정보를 저장하는 테이블"""
    class PaymentMethodChoices(models.TextChoices):
        METHOD = ("신용카드", "무통장입금")
    user = models.ForeignKey(User, on_delete=models.CASCADE) # 사용자
    type_ = models.CharField(choices=PaymentMethodChoices.choices, verbose_name="type") # 결제수단
    company = models.CharField(max_length=20) # 카드/은행사
    number = models.CharField(max_length=20) # 카드/계좌번호
 
 
class Payment(CommonModel):
    product = models.ForeignKey(Product, on_delete=models.SET_NULL, null=True)
    user = models.ForeignKey(User, on_delete=models.SET_NULL, null=True)
    price = models.PositiveIntegerField(null=False)
    delivery_fee = models.PositiveIntegerField(null=False)
    amount = models.PositiveIntegerField(null=False)
    payment_method = models.ForeignKey(Method, on_delete=models.SET_NULL, null=True)
    delivery_address = models.TextField(null=True, blank=True)
    successed_at = models.DateTimeField(null=True)
    canceled_at = models.DateTimeField(null=True)
    deliveried_at = models.DateTimeField(null=True)

3️⃣ Today I Learned